function ajaxChangeImage(params, callback) {
    
    
    if(params.button == undefined) {
        var btn = document.getElementById(params.file);
        var eventType = 'change';
    }
    else {
        var btn = document.getElementById(params.button);
        var eventType = 'click';
    }
    
    var input = document.getElementById(params.file); 
    formdata = false;


    if (window.FormData) {
        formdata = new FormData();
    }
        
    btn.addEventListener(eventType, function (evt) {
        
        var reader, file;
        file = input.files[0];

        if (!!file.type.match(/image.*/)) {
            if ( window.FileReader ) {
                reader = new FileReader();
                reader.readAsDataURL(file);
            }
            if (formdata) {
                formdata.append("image", file);
            }
        }

        if(params.picId != undefined) {
            formdata.append('picId', params.picId);
        }
        
        if(params.title != undefined) {
            formdata.append('title', params.title);
        }
        
        if(params.albumId != undefined) {
            formdata.append('albumId', params.albumId);
        }
        
        if (formdata) {
            $.ajax({
                url:  params.url,
                type: "POST",
                data: formdata,
                processData: false,
                contentType: false,
                success: function (res) {
//                    $('#info').html(res)
                }
            }).done(function() {
                callback(params.image);
            });
        }
        
    }, false);
}
